package com.midian.common.pay.tenpay.xmlutil;

import org.apache.log4j.Logger;

import com.midian.common.pay.vo.WXPrepayBack;
import com.midian.common.utils.HttpClientUtils;

public class WechatUtils {		
	
	private static final Logger LOG = Logger.getLogger(WechatUtils.class);
	
	/**
	 * 微信支付生成订单的预付款ID
	 * @param msg 发送的数据
	 * @return 预付款对象
	 */
	public static WXPrepayBack getWXPrepay(String msg){		
		String url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
		String retmsg = HttpClientUtils.getHttpRes(url, "POST", msg);
		LOG.error(retmsg);
		WXPrepayBack prepay = ReceiveXmlUtils.getMsgEntity(retmsg, WXPrepayBack.class);
		return prepay;
	}
}
